/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package edu.wpi.first.wpilibj.templates.commands;

import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.wpilibj.templates.RobotMap;

/**
 *
 * @author Developer
 */
public class aim extends CommandBase {
    public double setpoint;
    public aim() {
        // Use requires() here to declare subsystem dependencies
        // eg. requires(chassis);
        requires(camAim);
    }

    // Called just before this Command runs the first time
    protected void initialize() {
        camAim.setSetpoint(150);
    }

    // Called repeatedly when this Command is scheduled to run
    protected void execute() {
        if(RobotMap.liftDownLimit.get())
        {
            if (RobotMap.aimMotor.get() > 0)
            {
                RobotMap.aimMotor.set(0);
            }
        }
        else
        {
            camAim.enable();
        }
    }

    // Make this return true when this Command no longer needs to run execute()
    protected boolean isFinished() {
        return (Math.abs(camAim.getPosition() - 150) < 3);
    }

    // Called once after isFinished returns true
    protected void end() {
        camAim.disable();
        SmartDashboard.putString("Shooter Status","Ready");
    }

    // Called when another command which requires one or more of the same
    // subsystems is scheduled to run
    protected void interrupted() {
    
        this.end();
    }
}
